import radio from '@/assets/images/user/choice_me.png'
interface IProp {
  data: IQuetionType;
  checks: string[];
  onChange: (value: string) => void
}

export default function OptionItem({ data, checks, onChange }: IProp) {
  const clickHandle = () => {
    // 通知父组件，我被点击了
    onChange(data.key)
  }
  return (
    <div className='option-item' onClick={clickHandle}>
      <div className="check">
        <img src={radio} alt="" style={{ display: checks.includes(data.key) ? 'block' : 'none' }} />
      </div>
      <div className="sort">{data.key}</div>
      <div className="content">{data.value}</div>
    </div>
  )
}
